import os

def reader() -> list:
    result = []
    if not os.path.exists("minego.ini"):
        open("minego.ini", "w").close()
        return result
    
    try:
        with open("minego.ini", "r") as f:
            for line in f:
                try:
                    number = int(line.strip())
                    result.append(number)
                except ValueError:
                    print(f"Warning: Skipping invalid line: {line.strip()}")
    except IOError as e:
        print(f"Error reading file: {e}")
        return []
    
    return result

def writer(data: list) -> None:
    try:
        with open("minego.ini", "w") as f:
            for item in data:
                f.write(f"{item}\n")
    except IOError as e:
        print(f"Error writing to file: {e}")

if __name__ == "__main__":
    numbers = reader()
    print("Read numbers:", numbers)
    numbers.append(42)
    writer(numbers)